<%@ Page Title="New User" Language="C#" MasterPageFile="~/Pages/admin/adminMaster.Master" AutoEventWireup="true" CodeBehind="NewUser.aspx.cs" Inherits="WarehouseWebAPP.Pages.admin.New_Entities.NewUser" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table class="style1">
    <tr>
        <td>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <asp:DetailsView ID="UserDetailsView" runat="server" AllowPaging="True" 
                AutoGenerateRows="False" CellPadding="4" DataKeyNames="user_num" 
                DataSourceID="UserObjectDataSource" DefaultMode="Insert" ForeColor="#333333" 
                GridLines="None" Height="50px" Width="592px">
                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                        <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />
                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                        <Fields>
                            <asp:BoundField DataField="user_num" HeaderText="user_num" ReadOnly="True" 
                        SortExpression="user_num" Visible="False" />
                            <asp:TemplateField HeaderText="User ID No." SortExpression="user_id">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("user_id") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("user_id") %>' 
                                ToolTip="9 Digits."></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                ControlToValidate="TextBox2" ErrorMessage="*"></asp:RequiredFieldValidator>
                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" 
                                ControlToValidate="TextBox2" ErrorMessage="Invalid ID." ToolTip="9 Digits." 
                                ValidationExpression="\d{9}"></asp:RegularExpressionValidator>
                                </InsertItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("user_id") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="User Name" SortExpression="user_name">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("user_name") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("user_name") %>'></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                                ControlToValidate="TextBox1" ErrorMessage="*"></asp:RequiredFieldValidator>
                                    <asp:CustomValidator ID="CustomValidator2" runat="server" 
                                ControlToValidate="TextBox1" ErrorMessage="Already Exist" 
                                onservervalidate="CustomValidator2_ServerValidate"></asp:CustomValidator>
                                </InsertItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("user_name") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="user_address" HeaderText="Address" 
                        SortExpression="user_address" />
                            <asp:TemplateField HeaderText="Phone No." SortExpression="user_phone">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("user_phone") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("user_phone") %>'></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                                ControlToValidate="TextBox3" ErrorMessage="*"></asp:RequiredFieldValidator>
                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                                ControlToValidate="TextBox3" ErrorMessage="Invalid Phone No" 
                                
                                
                                        ValidationExpression="^0[23489]{1}(\-)?[^0\D]{1}\d{6}$|^0(5[012345678]){1}(\-)?\d{7}$"></asp:RegularExpressionValidator>
                                </InsertItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("user_phone") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="E-mail Address" SortExpression="user_email">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("user_email") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("user_email") %>'></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                                ControlToValidate="TextBox4" ErrorMessage="*"></asp:RequiredFieldValidator>
                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                                ControlToValidate="TextBox4" ErrorMessage="Invalid E-mail" 
                                ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                                </InsertItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("user_email") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="User Type" SortExpression="user_type">
                                <EditItemTemplate>
                                    <asp:DropDownList ID="DropDownList1" runat="server" 
                                DataSourceID="TypeObjectDataSource" DataTextField="user_type" 
                                DataValueField="user_type_num" SelectedValue='<%# Bind("user_type") %>'>
                                    </asp:DropDownList>
                                    <asp:ObjectDataSource ID="TypeObjectDataSource" runat="server" 
                                SelectMethod="UserTypeGet" TypeName="WarehouseWebAPP.code.BLL.UserTypeBLL">
                                    </asp:ObjectDataSource>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:DropDownList ID="DropDownList1" runat="server" 
                                DataSourceID="TypeObjectDataSource" DataTextField="user_type" 
                                DataValueField="user_type_num" SelectedValue='<%# Bind("user_type") %>'>
                                    </asp:DropDownList>
                                    <asp:ObjectDataSource ID="TypeObjectDataSource" runat="server" 
                                SelectMethod="UserTypeGet" TypeName="WarehouseWebAPP.code.BLL.UserTypeBLL">
                                    </asp:ObjectDataSource>
                                </InsertItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="TypeLabel" runat="server" Text='<%# Bind("user_type") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Login Name" 
                        SortExpression="user_login_name">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("user_login_name") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("user_login_name") %>'></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                                ControlToValidate="TextBox1" ErrorMessage="*"></asp:RequiredFieldValidator>
                                    <asp:CustomValidator ID="CustomValidator3" runat="server" 
                                ControlToValidate="TextBox1" ErrorMessage="Already Exist" 
                                onservervalidate="CustomValidator3_ServerValidate"></asp:CustomValidator>
                                    <br />
                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" 
                                ControlToValidate="TextBox5" ErrorMessage="Invalid Username" 
                                ValidationExpression="^[a-zA-Z0-9_]{5,20}$"></asp:RegularExpressionValidator>
                                </InsertItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label5" runat="server" Text='<%# Bind("user_login_name") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Login Password" SortExpression="user_password">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("user_password") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:Label ID="Label9" runat="server" ForeColor="#E9ECF1" Text="Type Password:"></asp:Label>
                                    &nbsp;&nbsp;
                                    <asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("user_password") %>' 
                                TextMode="Password" 
                                
                                ToolTip="The password must be at least 4 characters long and start and end with a letter." 
                                Width="128px"></asp:TextBox>
                                    <cc1:PasswordStrength ID="TextBox6_PasswordStrength" runat="server" 
                                TargetControlID="TextBox6"
                                TextStrengthDescriptions="Very Poor;Weak;Average;Strong;Excellent"
                                
                                TextStrengthDescriptionStyles="cssClass1;cssClass1;cssClass1;cssClass1;cssClass1" >
                                    </cc1:PasswordStrength>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" 
                                ControlToValidate="TextBox6" ErrorMessage="*"></asp:RequiredFieldValidator>
                                    <br />
                                    <asp:Label ID="Label8" runat="server" ForeColor="#E9ECF1" 
                                Text="Verify Password:"></asp:Label>
                                    &nbsp;<asp:TextBox ID="VerifyTextBox" runat="server" TextMode="Password" 
                                Width="128px"></asp:TextBox>
                                    <asp:CompareValidator ID="CompareValidator1" runat="server" 
                                ControlToCompare="TextBox6" ControlToValidate="VerifyTextBox" 
                                ErrorMessage="Verification Failed."></asp:CompareValidator>
                                </InsertItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label6" runat="server" Text='<%# Bind("user_password") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:CommandField ShowInsertButton="True" />
                        </Fields>
                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <EditRowStyle BackColor="#999999" />
                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                    </asp:DetailsView>
                </ContentTemplate>
            </asp:UpdatePanel>
            <asp:ObjectDataSource ID="UserObjectDataSource" runat="server" 
                InsertMethod="UserInsert" SelectMethod="userGet" 
                TypeName="WarehouseWebAPP.code.BLL.UserBLL">
                <InsertParameters>
                    <asp:Parameter Name="user_id" Type="String" />
                    <asp:Parameter Name="user_name" Type="String" />
                    <asp:Parameter Name="user_address" Type="String" />
                    <asp:Parameter Name="user_phone" Type="String" />
                    <asp:Parameter Name="user_email" Type="String" />
                    <asp:Parameter Name="user_type" Type="String" />
                    <asp:Parameter Name="user_login_name" Type="String" />
                    <asp:Parameter Name="user_password" Type="String" />
                </InsertParameters>
            </asp:ObjectDataSource>
        </td>
    </tr>
</table>
</asp:Content>
